export default (el, binding) => {
  const { arg, value } = binding
  if (arg && Array.isArray(value) && value.length > 0) {
    let hasPermission = value.includes(arg)
    if (!hasPermission) {
      if (el.parentNode) {
        el.parentNode.removeChild(el)
      } else {
        el.style.display = 'none'
      }
    }
  } else {
    throw new Error(`eg: v-permission:submitBtn="['submitBtn', 'uploadBtn']"`)
  }
}
